package reportd

import (
	"time"

	creportd "gogs.xiaoyuanjijiehao.com/antlinker/antcms/core/reportd"

	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/ddd"
)

// @collname 举报集合(i_report)
type collReport struct {
	ReportID   string    `bson:"_id" `
	Content    string    `bson:"content"`    // 举报理由
	TargetType int       `bson:"targetType"` // 举报类型 1 信息 2 其他
	TargetID   string    `bson:"targetID"`   // 举报编号
	Tags       []string  `bson:"tags"`       // 举报标签
	Status     int       `bson:"status"`     // 举报状态 0 未处理　１　已处理 -1 已删除
	UID        string    `bson:"uid"`        // 举报用户
	RepTime    time.Time `bson:"repTime"`    // 举报时间
	Result     string    `bson:"result"`     // 处理结果
	ProcUID    string    `bson:"procUID"`    // 处理用户
	ProcTime   time.Time `bson:"procTime"`   // 处理时间

}

func (c collReport) CollID() string {
	return c.ReportID
}
func (collReport) CollName() string {
	return collNameReport
}

func (c *collReport) FullDesc(e creportd.ReportDesc) {
	c.Content = e.Content
	c.TargetType = e.TargetType
	c.TargetID = e.TargetID
	c.Status = e.Status
	c.UID = e.UID
	c.RepTime = e.RepTime
	c.Tags = e.Tags

}
func (c collReport) ToDesc() creportd.ReportDesc {
	return creportd.ReportDesc{
		Content:    c.Content,
		TargetType: c.TargetType,
		TargetID:   c.TargetID,
		Status:     c.Status,
		UID:        c.UID,
		RepTime:    c.RepTime,
		Tags:       c.Tags,
	}
}

func (c *collReport) FullResult(e creportd.ReportResult) {
	c.Result = e.Result
	c.ProcUID = e.ProcUID
	c.ProcTime = e.ProcTime

}
func (c collReport) ToResult() creportd.ReportResult {
	return creportd.ReportResult{
		Result:   c.Result,
		ProcUID:  c.ProcUID,
		ProcTime: c.ProcTime,
	}
}

func (c collReport) ToAggregate() ddd.Aggregate {
	return c.ToReportAggregate()
}
func (c collReport) ToReportAggregate() *creportd.ReportAggregate {
	return &creportd.ReportAggregate{

		ReportDesc: c.ToDesc(),

		ReportResult: c.ToResult(),
	}
}
